<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";
%>
<html>
	<head>
		<base href="<%=basePath%>">
		<title>读者信息修改页</title>
		<link href="css/bootstrap.css" rel='stylesheet' type='text/css'/>
		<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
		<script src="js/popper.min.js"></script>
		<script src="bootstrap-4.2.1/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="jquery/bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js"></script>
		<script type="text/javascript" src="jquery/bootstrap-datetimepicker-master/locale/bootstrap-datetimepicker.zh-CN.js"></script>
		<script>

			$(function (){

				//日历的控件
                $(".time").datetimepicker({
                    minView: "month",
                    language: 'zh-CN',
                    format: 'yyyy-mm-dd',
                    autoclose: true,
                    todayBtn: true,
                    pickerPosition: "bottom-left"
                });

                $("#updateBtn").click(function (){

                    $.ajax({
                        url: "author/updateReader.do",
                        data: {
                            "id":"${r.id}",
							"name":$("#edit-name").val(),
							"username":$("#edit-username").val(),
							"phone":$("#edit-phone").val(),
							"signature":$("#edit-signature").val(),
							"birth":$("#edit-birth").val(),
						},
                        type: "get",
                        dataType: "json",
                        success: function (data) {

                            if (data){
                                alert("更新成功!");
                                window.location.href="jsp/setting/readerManage.jsp";
                            }else {
                                alert("更新失败!")
                            }

                        }
                    })

				})

			})

		</script>
	</head>
	<body>

		<form class="form-horizontal" role="form" >
			<input type="hidden" id="edit-id" value="${r.id}">
			<div class="form-group">
				<label for="edit-name" class="col-sm-2 control-label">姓名<span style="font-size: 15px; color: red;">*</span></label>
				<div class="col-sm-10" style="width: 300px;">
					<input type="text" class="form-control" id="edit-name" placeholder="${r.name}" >
				</div>
			</div>
			<div class="form-group">
				<label for="edit-username" class="col-sm-2 control-label">用户名</label>
				<div class="col-sm-10" style="width: 300px;">
					<input type="text" class="form-control" id="edit-username" placeholder="${r.username}">
				</div>
				<label for="edit-phone" class="col-sm-2 control-label">电话</label>
				<div class="col-sm-10" style="width: 300px;">
					<input type="text" class="form-control" id="edit-phone" placeholder="${r.phone}">
				</div>
			</div>
			<div class="form-group">
				<label for="edit-signature" class="col-sm-2 control-label">个性签名</label>
				<div class="col-sm-10" style="width: 300px;">
					<input type="text" class="form-control" id="edit-signature" placeholder="${r.signature}">
				</div>
			</div>
			<div class="form-group">
				<label for="edit-birth" class="col-sm-2 control-label">生日</label>
				<div class="col-sm-10" style="width: 81%;">
					<input type="text" class="form-control time" readonly id="edit-birth" placeholder="${r.birth}">
				</div>
			</div>
			<div>
				<button type="button" class="btn btn-default">关闭</button>
				<button type="button" class="btn btn-primary" id="updateBtn" >更新</button>
			</div>
		</form>
	</body>
</html>
